import {
	mapGetters
} from 'vuex'

export default {
	computed: {
		...mapGetters('m_cart', ['allTotal'])
	},
	watch: {
		allTotal() {
			this.setBadge()
		}
	},
	onShow() {
		this.setBadge()
	},
	methods: {
		setBadge() {
			if (Number(this.allTotal) > 0) {
				uni.setTabBarBadge({
					index: 2,
					text: this.allTotal + ''
				})
			}else{
				uni.hideTabBarRedDot({
					index:2
				})
			}

		}
	}
}
